﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ShowReleases.aspx.cs" Inherits="Actuals.ShowReleases" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <link href="~/Actuals.css" rel="Stylesheet" type="text/css" />
    <link href="~/themes/ui-lightness/jquery.ui.all.css" rel="Stylesheet" type="text/css" />
    <title>Show Release</title>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.datepicker.js") %>"></script>
    <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/jquery.ui.core.js") %>"></script>
    <script type="text/javascript">

        function ShowAddRelease() {

            var projectId = document.getElementById("ddlProject").value;
            var url = "AddRelease.aspx?Mode=Add&ProjectId=" + projectId;
            var result = window.showModalDialog(url, this, 'dialogHeight:300px;dialogWidth:400px; Status:yes; Toolbars:no; Help:no; Center:yes');
            __doPostBack('refresh', 'refresh');

        }

        function ShowUpdateRelease(releaseId) {
            var projectId = document.getElementById("ddlProject").value;
            var url = "AddRelease.aspx?Mode=Edit&ReleaseId=" + releaseId + "&ProjectId=" + projectId; ;
            var result = window.showModalDialog(url, this, 'dialogHeight:300px; dialogWidth:400px; Status:yes; Toolbars:no; Help:no; Center:yes;');
            __doPostBack('refresh', 'refresh');
        }

        function TestCheckBox() {
            var Target = null;
            Target = document.getElementById("<%= this.gvShowRelease.ClientID %>");
            if (Target == null) {
                alert("No record is selected!Please Select one!");
                return false;
            }
            var Inputs = document.getElementsByTagName("input");
            for (var n = 0; n < Inputs.length; ++n) {
                if (Inputs[n].type == "checkbox" && Inputs[n].checked)
                    return confirm("Do you want to Delete!");

            }
            alert("No record is selected!.Please Select one!");
            return false;
        }
    </script>
</head>
<body>

    <form id="form1" runat="server">
    <center>
       <asp:Label ID="lblMsg" runat="server" CssClass="message"></asp:Label>
        <div id="divShowRelease">
            <table>
                <tr>
                    <td>
                        <asp:Label ID="lblProject" runat="server" CssClass="label">Project</asp:Label>
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="ddlProject" runat="server" CssClass="textfield">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td align="center">
                        <asp:Button ID="btnShowRelease" runat="server" Text="Show Releases" OnClick="btnShowRelease_Click" />
                    </td>
                </tr>
            </table>
        </div>
        <div runat="server" id="divControls">
            <div id="divGrid" style="border: solid 1px silver; height: 600px; text-align: center;
                overflow-x: hidden; overflow-y: auto;">
                <asp:GridView ID="gvShowRelease" runat="server" AutoGenerateColumns="false" BorderColor="Black"
                    AllowPaging="false" AllowSorting="true" ShowFooter="true" OnRowCommand ="gvShowRelease_OnRowCommand">
                    <HeaderStyle BackColor="White" Font-Size="10px" ForeColor="#990000" BorderStyle="None" />
                    <RowStyle BackColor="#F7F3F7" Font-Names="Verdana" Font-Size="XX-Small" BorderStyle="None" />
                    <AlternatingRowStyle BackColor="White" Font-Names="Verdana" Font-Size="XX-Small"
                        BorderStyle="None" />
                    <Columns>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:CheckBox ID="chkShowRelease" runat="server" AutoPostBack="false" />
                            </ItemTemplate>
                        </asp:TemplateField>
                         <asp:TemplateField Visible="false">
                            <ItemTemplate>
                                <asp:Label ID="lblReleaseId" runat="server" Text='<%# Bind("ReleaseId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="Description" HeaderText="ReleaseDescription" />
                        <asp:BoundField DataField="StartDate" HeaderText="StartDate" />
                        <asp:BoundField DataField="EndDate" HeaderText="EndDate" />
                         <asp:TemplateField HeaderText="Team">
                            <ItemTemplate>
                                <asp:Label ID="lblTeam" runat="server" Text='<%# getTeam(Eval("TeamId")) %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderStyle-Width="5%" ItemStyle-Width="5%" ItemStyle-BorderStyle="None"
                            HeaderStyle-BorderStyle="None">
                            <ItemTemplate>
                                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="EditRelease" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"ReleaseId") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
        
        
            <asp:Button ID="btnAddRelease" runat="server" CssClass="button" Text="Add Release"
                OnClientClick="return ShowAddRelease()" />
            <asp:Button ID="btnDeleteRelease" runat="server" CssClass="button" Text="Delete" OnClientClick="retrun TestCheckBox()" OnClick="btnDeleteRelease_Click" />
            </div>
            </div>
          </center>
    </form>
</body>
</html>
